﻿@using MvcContrib.UI.Pager
@using MvcContrib.UI.Grid 
@using MvcContrib.Pagination 

@model ENail.Portal.Web.Models.ReceiptViewModel

@{
    ViewBag.Title = "Receipt";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div id="content">
    @using (Html.BeginForm())
    {
    <table width="100%">
        <tr>
            <td><input type="button" value="Save" onclick="document.forms(0).submit()" /></td>
            <td><input type="button" value="Delete" onclick="document.forms(1).submit()" style="visibility:@(Model.Id == 0 ? "hidden" : "visible")" /></td>
            <td>Customer:@Model.CustomerName</td>
            <td>Status:@Model.RegistrationStatus</td>
        </tr>
    </table>

    <table>
        <tr>
            <td>@Html.ValidationSummary()</td>
            <td></td>
        </tr>
        <tr>
            <td colspan="2">
                <table>
                    <tr>
                        <td>
                            @Html.Grid(Model.ReceiptItems).Columns((column) =>
                                                {
                                                    column.For(x => Html.CheckBox("chkIsSelected", x.IsSelected))
                                                            .Named("");
                                                    column.For(x => x.NailServiceName)
                                                            .Named("Service")
                                                            .Attributes(width => "200px");
                                                    column.For(x => x.EmployeeFirstName)
                                                            .Named("Employee")
                                                            .Attributes(width => "200px");
                                                    column.For(x => x.Price)
                                                            .Named("Price")
                                                            .Attributes(width => "150px");
                                                }
                                        ).Attributes(@class => "grid"
                                        ).HeaderRowAttributes(new Dictionary<string, object> { { "class", "gridheaderrow" } }
                                        ).RowAttributes(row => new Dictionary<string, object> { { "onclick", "document.location='" + Url.Action("Update", new { Id = row.Item.Id }) + "'"} })
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td width="500px" align="right">Sub Total:</td>
            <td>@Html.TextBoxFor(x => x.SubTotal, new { width = "150px" })</td>
        </tr>
        <tr>
            <td>Discount:</td>
            <td>@Html.TextBoxFor(x => x.Discount)</td>
        </tr>
        <tr>
            <td>Tax:</td>
            <td>@Html.TextBoxFor(x => x.Tax)</td>
        </tr>
        <tr>
            <td>Total:</td>
            <td>@Html.TextBoxFor(x => x.Total)</td>
        </tr>
    </table>
    }

    @using (Html.BeginForm("Delete", "Registration", new { id = Model.Id }))
    {
    }
</div>

